<template>
	<view class="progress-detail">
		<view
			class="progress-detail-list flex-center"
			v-for="(item, index) in progressDetailList"
			:key="index">
			<view>
				<view class="progress-detail-list-time">{{item.ScheduleTime.split(' ')[1]}}</view>
				<view class="progress-detail-list-date">{{item.ScheduleTime.split(' ')[0]}}</view>
			</view>
			<view class="bull">&bull;</view>
			<view class="progress-detail-list-text">
				{{item.RepairState}}
			</view>
		</view>
		
		<view class="submit-btn">
			<button @click="pageTo">服务评价</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				progressDetailList: []
			}
		},
		onLoad(option) {
			this.getProgressDetail(option.id)
		},
		methods: {
			/**
			 * 获取进度数据
			 * @param {String} woid
			 */
			async getProgressDetail(woid) {
				let res = await this.$http.request({
					method: 'post',
					url: '/api/work_order/list',
					data: {
						woid: woid
					}
				})
				if (res.status === 1) {
					this.progressDetailList = res.data.service_schedule && res.data.service_schedule.reverse()
				} else {
					uni.showToast({
						title: res.message,
						icon: 'none',
						duration: 3000
					})
				}
			},
			pageTo() {
				uni.navigateTo({
					url: 'rate'
				});
			},
		}
	}
</script>

<style lang="scss">
	.progress-detail{
		height: 100%;
		box-sizing: border-box;
		padding: 90rpx 0 0 60rpx;
		background: $uni-bg-color;
		&-list{
			margin-bottom: 66rpx;
			&-time{
				text-align: center
			}
			&-date{
				font-size: $uni-font-size-sm1;
				text-align: center;
				color: $uni-text-color-grey;
			}
			.bull{
				margin: 0 30rpx;
				color: $uni-color-theme;
			}
			&-text{
				font-weight: bold;
			}

			
		}
		.submit-btn{
			position: fixed;
			bottom: 0;
			left: 0;
			right: 0;
			padding: 0 30rpx;
		}
	}
</style>
